﻿using System;
using System.Configuration;
using Sustainalytics.Utils;

namespace Sustainalytics.Admin.CRMSynchronization.Service
{
    class ProgramConsole
    {
        internal static void Start()
        {
            try
            {
                var hostUrl = ConfigurationManager.AppSettings["HostUrl"];

                using (Microsoft.Owin.Hosting.WebApp.Start<Startup>(hostUrl))
                {
                    System.Console.WriteLine("Synchronization host started on: " + hostUrl);

                    System.Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ExceptionUtility.GetInfo(ex, true));
                System.Console.ReadKey();
            }
        }
    }
}
